package com.doubi.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.doubi.entity.Userinfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface UserinfoMapper extends BaseMapper<Userinfo> {
    //修改个人信息
    @Update("update userinfo set userName=#{userinfo.userName},phoneNum=#{userinfo.phoneNum},address=#{userinfo.address},synopsis=#{userinfo.synopsis},gender=#{userinfo.gender} where userid=#{userinfo.userId}")
    int saveUserInfo(@Param("userinfo") Userinfo userinfo);
    //查询手机号是否唯一
    @Select("select COUNT(*) from userinfo where phoneNum = #{phoneNum} and userId <> #{userId}")
    Integer selectIphone(@Param("phoneNum") String phoneNum, @Param("userId") int userId);
    //保存图片
    @Update("update userinfo set headImg =#{frilmsg} where userId =#{userId}")
    Integer saveImg(@Param("frilmsg") String frilmsg,@Param("userId") Integer userId);
    //条件查询用户信息
    List<Userinfo> userConditionQuery(@Param("selUserName") String selUserName,@Param("selUserAccount") String selUserAccount,@Param("selPhone") String selPhone,@Param("selWeiXin") String selWeiXin);
    //批量删除用户
    int delUserByIds(@Param("userIds") List<Integer> userIds);
}
